<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['product']) && (($_SESSION['product']&1<<2) == 0))) {
	$this->_redirect(HOST_BACKEND);
}
$intProductId 		= $objRequest->getParam('productid', 0);
$objProduct			= new Product();
$objCategory		= new Category();
$objSlideshow		= new Slideshow();
$arrRow				= $objProduct->get($intProductId);
if(isset($_SESSION['PRODUCT_POST']['pcategoryid'])) $intCategoryId = $_SESSION['PRODUCT_POST']['pcategoryid'];
else $intCategoryId = $arrRow['categoryid'];
$this->view->row			= $arrRow;
$this->view->back			= isset($_SESSION[SESSION_BACKURL]) ? $_SESSION[SESSION_BACKURL] : HOST_BACKEND;
$this->view->arrCategory	= $objCategory->getParent(PRODUCT_TYPE);
$this->view->arrSub			= $objCategory->getChild($intCategoryId);
$this->view->arrAlbum		= $objSlideshow->getAlbumForCombo(PRODUCT_TYPE);
if(isset($_SESSION['PRODUCT_POST']['ptbfeature'])) {
	$strJson	= str_replace('\\','',$_SESSION['PRODUCT_POST']['ptbfeature']);	
	$this->view->arrFeatures = json_decode($strJson);
}elseif(isset($arrRow['features'])) {
	$strJson	= str_replace('\\','',$arrRow['features']);	
	$this->view->arrFeatures = json_decode($strJson);
}